-include ../Makefile.include

kbuild_dir := kernel
dbuild_dir := driver
ubuild_dir := user
e1000_ver  := 8.0.25
e1000_dir  := e1000-$(e1000_ver)-pfring/src
e1000e_ver := 1.2.17
e1000e_dir := e1000e-$(e1000e_ver)-pfring/src

export e1000_ver e1000_dir e1000e_ver e1000e_dir

$(package):
	-rm -rf tmp
	mkdir -p tmp/lib/modules/$(KERNEL_VER)/kernel/drivers/
	cd $(kbuild_dir) && make
	make -C $(dbuild_dir)
	make -C $(ubuild_dir)
	install -D $(kbuild_dir)/pf_ring.ko tmp/lib/modules/$(KERNEL_VER)/kernel/drivers/net/pf_ring.ko
	install -D $(dbuild_dir)/e1000/$(e1000_dir)/e1000.ko tmp/lib/modules/$(KERNEL_VER)/kernel/drivers/net/e1000.ko
	install -D $(dbuild_dir)/e1000e/$(e1000e_dir)/e1000e.ko tmp/lib/modules/$(KERNEL_VER)/kernel/drivers/net/e1000e.ko
	install -D $(ubuild_dir)/tcpdump-4.0.0-pfring/tcpdump tmp/usr/sbin/tcpdump
	tar -C tmp -cpzf $@ .

clean: $(software)_clean
	make -C $(ubuild_dir) clean
	make -C $(dbuild_dir) clean
	cd $(kbuild_dir) && make clean

